<?php

use think\migration\Seeder;

class StudentTableSeeder extends Seeder
{
    /**
     * Run Method.
     *
     * Write your database seeder using this method.
     *
     * More information on writing seeders is available here:
     * http://docs.phinx.org/en/latest/seeding.html
     */
    public function run()
    {
        $rows = [];
        for ($i=0; $i < 35; $i++) { 
            $rows[] = [
                'account' => '186823' . mt_rand(10000,99999),
                'password' => password_hash(md5('123456'),PASSWORD_DEFAULT),
                'truename' => '测试昵称',
                'course_id' => mt_rand(1,4),
                'semester_id' => mt_rand(1,2),
                'province_code' => 440000,
                'city_code' => 440300,
                'amount' => 100,
                'last_login_time' => date('Y-m-d H:i:s'),
                'birthday' => '2000-01-01',
                'last_login_ip' => 110,
                'source_id' => mt_rand(1,2),
                'referrer' => '张三',
                'apply_time' => date('Y-m-d'),
                'create_time' => date('Y-m-d H:i:s'),
                'update_time' => date('Y-m-d H:i:s')
            ];
        }

        $this->table('student')->insert($rows)->save();
    }
}